﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using edu.Model;
using edu.Service;
using System.Data;

public partial class dailyActionForTeacher : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    int i = 0;
    List<DailyBehavior> behaviors = new List<DailyBehavior>();
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (i % 4 == 0)
        {
            e.Item.Controls.Add(new LiteralControl(" </tr> <tr><tr><td style=\"height: 10px\"></td></tr>"));
        }
        i++;

        RadioButton normalRadioBtn = e.Item.FindControl("normalRadioBtn") as RadioButton;
        RadioButton abnormalRadioBtn = e.Item.FindControl("abnormalRadioBtn") as RadioButton;
        normalRadioBtn.CheckedChanged += (o, e1) =>
        {
            if ((o as RadioButton).Checked)
            { 
                //behaviors.Add(new DailyBehavior(){StudentId=e.Item.DataItem
            }
        };
        abnormalRadioBtn.CheckedChanged += (o, e1) =>
        {
            if ((o as RadioButton).Checked)
            {
                //behaviors.Add(new DailyBehavior(){StudentId=e.Item.DataItem
            }
        };
    }
    protected void classDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataTable students = StudentService.GetStudentsByClassId(Int32.Parse((sender as DropDownList).SelectedValue));

        Repeater rp = this.Controls[0].FindControl("ContentPlaceHolder1").FindControl("Repeater1") as Repeater;
        rp.DataSource = students;
        rp.DataBind();
    }
}
